package com.junchao.peng.pojo;

import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @author dell
 */
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    private Integer id;
    private Integer positionId;
    private String email;
    private String name;
    private String phone;
    private Boolean status;
    private Boolean admin;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
    private Integer updateId;
    private String password;

    public User(Integer id, Integer positionId, String email, String name, String phone, Boolean status, Boolean admin, Date createTime, Date updateTime, Integer updateId, String password) {
        this.id = id;
        this.positionId = positionId;
        this.email = email;
        this.name = name;
        this.phone = phone;
        this.status = status;
        this.admin = admin;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.updateId = updateId;
        this.password = password;
    }

    public User() {
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPositionId() {
        return positionId;
    }

    public void setPositionId(Integer positionId) {
        this.positionId = positionId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Boolean getAdmin() {
        return admin;
    }

    public void setAdmin(Boolean admin) {
        this.admin = admin;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Integer updateId) {
        this.updateId = updateId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof User)) {
            return false;
        }
        User user = (User) o;
        return getId().equals(user.getId()) && getPositionId().equals(user.getPositionId()) && getEmail().equals(user.getEmail()) && getName().equals(user.getName()) && getPhone().equals(user.getPhone()) && getStatus().equals(user.getStatus()) && getAdmin().equals(user.getAdmin()) && getCreateTime().equals(user.getCreateTime()) && getUpdateTime().equals(user.getUpdateTime()) && getUpdateId().equals(user.getUpdateId()) && password.equals(user.password);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getPositionId(), getEmail(), getName(), getPhone(), getStatus(), getAdmin(), getCreateTime(), getUpdateTime(), getUpdateId(), password);
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", positionId=" + positionId +
                ", email='" + email + '\'' +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", status=" + status +
                ", admin=" + admin +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", updateId=" + updateId +
                ", password='" + password + '\'' +
                '}';
    }
}
